home *** CD-ROM | disk | FTP | other *** search
/ Aminet 33 / Aminet 33 - October 1999.iso / Aminet / dev / src / WBBump_src.lha / WBBump_src / get_bumper.e < prev    next >
Encoding:
Text File  |  1999-06-30  |  2.7 KB  |  104 lines

  1. /* ************ */
  2. /* get_bumper.e */
  3. /* ************ */
  4.  
  5.  
  6.  
  7. /*
  8.     WBBump - Bumpmapping on the Workbench!
  9.  
  10.     Copyright (C) 1999  Thomas Jensen - dm98411@edb.tietgen.dk
  11.  
  12.     This program is free software; you can redistribute it and/or modify
  13.     it under the terms of the GNU General Public License as published by
  14.     the Free Software Foundation; either version 2 of the License, or
  15.     (at your option) any later version.
  16.  
  17.     This program is distributed in the hope that it will be useful,
  18.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20.     GNU General Public License for more details.
  21.  
  22.     You should have received a copy of the GNU General Public License
  23.     along with this program; if not, write to the Free Software Foundation,
  24.     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  25. */
  26.  
  27.  
  28.  
  29. OPT MODULE
  30. OPT    PREPROCESS
  31.  
  32.  
  33. #define CYBRMATTR_XMOD        $80000001 /* function returns BytesPerRow if its called with this parameter */
  34. #define CYBRMATTR_BPPIX       $80000002 /* BytesPerPixel shall be returned */
  35. #define CYBRMATTR_DISPADR     $80000003 /* do not use this ! private tag */
  36. #define CYBRMATTR_PIXFMT      $80000004 /* the pixel format is returned */
  37. #define CYBRMATTR_WIDTH       $80000005 /* returns width in pixels */
  38. #define CYBRMATTR_HEIGHT      $80000006 /* returns height in lines */
  39. #define CYBRMATTR_DEPTH       $80000007 /* returns bits per pixel */
  40. #define CYBRMATTR_ISCYBERGFX  $80000008 /* returns -1 if supplied bitmap is a cybergfx one */
  41. #define CYBRMATTR_ISLINEARMEM $80000009 /* returns -1 if supplied bitmap is linear accessable */
  42.  
  43.  
  44. MODULE    'cybergraphics',
  45.         'libraries/cybergraphics',
  46.  
  47.         'intuition/intuition',
  48.         'intuition/screens',
  49.  
  50.         'graphics/gfx',
  51.         'graphics/rastport'
  52.  
  53.  
  54. MODULE    '*bumper',
  55.         '*bumper_cgx8',
  56.         '*bumper_cgx24',
  57.         '*prefs',
  58.         '*plugin',
  59.         '*pluginmanager',
  60.         '*errors'
  61.  
  62.  
  63.  
  64. EXPORT PROC get_bumper(p:PTR TO prefs, plist:PTR TO pluginlist) HANDLE
  65.     DEF    b_cgx8=NIL:PTR TO bumper_cgx8,
  66.         b_cgx24=NIL:PTR TO bumper_cgx24,
  67.         s=NIL:PTR TO screen
  68.  
  69.     s := LockPubScreen(p.scrname)
  70.     IF s=NIL THEN eThrow(ERR_LOCKSCR, 'Unable to lock screen: "%s"', [p.scrname])
  71.  
  72.     IF (cybergfxbase <> NIL)
  73.  
  74.         IF GetCyberMapAttr(s.rastport.bitmap, CYBRMATTR_ISCYBERGFX)
  75.  
  76.             IF GetCyberMapAttr(s.rastport.bitmap, CYBRMATTR_PIXFMT) <> PIXFMT_LUT8
  77.  
  78.                 UnlockPubScreen(NIL, s); s := NIL
  79.                 NEW b_cgx24.bumper_cgx24(p, plist)
  80.                 RETURN b_cgx24
  81.  
  82.             ENDIF
  83.  
  84.         ENDIF
  85.  
  86.     ENDIF
  87.  
  88.     UnlockPubScreen(NIL, s); s := NIL
  89.     NEW b_cgx8.bumper_cgx8(p, plist)
  90.     RETURN b_cgx8
  91.  
  92.     eThrow(ERR_BADSCREEN, 'Bad screen: "%s"', [p.scrname])
  93.  
  94. EXCEPT DO
  95.     IF s THEN UnlockPubScreen(NIL, s)
  96.     IF exception
  97.         END b_cgx8
  98.     ENDIF
  99.     ReThrow()
  100. ENDPROC 0
  101.  
  102.  
  103.  
  104.